d = {}
for x in 'abac':
    if x in d:
        d[x] = d[x]+1
    else:
        d[x] = 1
print(d)

# 输出{'a': 2, 'b': 1, 'c': 1}